import 'package:FineArt/constants.dart';
import 'package:FineArt/utils/log_util.dart';
import 'package:FineArt/utils/size_config.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';

/// 列表项
class GridItemVideo extends StatelessWidget {
  // 文字
  final String url;

  //点击事件
  final GestureTapCallback onTap;
  final double width;
  final double height;
  final BoxFit boxFit;
  final String title;
  final String serious;

  // 构造函数
  const GridItemVideo(
      {Key key,
      this.url,
      this.onTap,
      this.width,
      this.height = 0,
      this.boxFit = BoxFit.cover,
      this.title = '',
      this.serious=''})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    String serio =  serious.length > 0 && serious != "undefined"
        ? "(" + serious + ")"
        : "";
    return InkWell(
        onTap: onTap,
        child: Padding(
          padding: EdgeInsets.all(1),
          child: Column(
             crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
            Stack(
              alignment: Alignment.center,
              children: [
                Image(
                    fit: boxFit,
                    width: width,
                    height: height,
                    image: CachedNetworkImageProvider(
                      url,
                    )),
                Icon(
                  Icons.play_circle_outline_outlined,
                  size: getPortraitSWidth(30),
                  color: Colors.white,
                ),
              ],
            ),
            Text(
              this.title+serio,
              style: TextStyle(color: text_black, fontSize: setSp(12)),
              overflow: TextOverflow.ellipsis,
            )
          ]),
        ));
  }
}
